package com.example.socdok;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Vibrator;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SurfaceHolder;

public class configState implements IState {
	Bitmap bt_toMenu;
	Bitmap bt_toEnd;
	Bitmap bt_toSound;
	Bitmap bt_toVibration;
	int x;
	int y;
	
	@Override
	public void Init(SurfaceHolder holder) {
		// TODO Auto-generated method stub
		bt_toMenu = AppManager.getInstance().getBitmap(R.drawable.to_introstate);
		bt_toEnd = AppManager.getInstance().getBitmap(R.drawable.to_creditstate);
		bt_toSound = AppManager.getInstance().getBitmap(R.drawable.bt_sound);
		bt_toVibration = AppManager.getInstance().getBitmap(R.drawable.bt_vibration);
		//SoundManager.getInstance().addSound(1, R.raw.s_background);
	}

	@Override
	public void Destroy() {
		// TODO Auto-generated method stub

	}

	@Override
	public void Update() {
		// TODO Auto-generated method stub

	}

	@Override
	public void Render(Canvas canvas) {
		// TODO Auto-generated method stub
		canvas.drawBitmap(bt_toMenu, 105, 0, null);
		canvas.drawBitmap(bt_toEnd, 105, 35, null);
		canvas.drawBitmap(bt_toSound, 105, 70, null);
		canvas.drawBitmap(bt_toVibration, 105, 105, null);

	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		// TODO Auto-generated method stub
int action = event.getAction();
		
		int m_x, m_y;
		m_x = (int) event.getX();
		m_y = (int) event.getY();
		
		Rect rt = new Rect();
		
		if(event.getAction() == MotionEvent.ACTION_DOWN){
			rt.set(105, 0, 210, 29);
			if(rt.contains(m_x, m_y)){
				AppManager.getInstance().getGameView().ChangeGameState(new IntroState());
			}
		
			rt.set(105, 35, 210, 64);
			if(rt.contains(m_x, m_y)){
				AppManager.getInstance().getGameView().ChangeGameState(new CreditState());
			}
			
			rt.set(105, 70, 210, 99);
			if(rt.contains(m_x, m_y)){
				
			}
			
			rt.set(105, 105, 210, 134);
			if(rt.contains(m_x, m_y)){
				
			}
			
		}
		return true;
	}

	@Override
	public void Init() {
		// TODO Auto-generated method stub
		
	}

}
